import uvm_pkg::*;
`include "uvm_macros.svh"

class spt_agent extends uvm_agent;
	spt_sequencer #(spt_packet) seqr;
	spt_driver drv;
	spt_tx_monitor spt_tx_mon;
	spt_rx_monitor spt_rx_mon;
	
	`uvm_component_utils(spt_agent)
	
	function new(string name, uvm_component parent);
		super.new(name, parent);
		`uvm_info(get_type_name(), "agent start...", UVM_HIGH);
	endfunction: new
	
	virtual function void build_phase(uvm_phase phase);
		super.build_phase(phase);
		`uvm_info(get_type_name(), "build_phase in agent start...", UVM_LOW);
		
		seqr = spt_sequencer::type_id::create("seqr",this);
		drv  = spt_driver::type_id::create("drv",this);
		spt_tx_mon = spt_tx_monitor::type_id::create("spt_tx_mon",this);
		spt_rx_mon = spt_rx_monitor::type_id::create("spt_rx_mon",this);
	endfunction: build_phase
	
	virtual function void connect_phase(uvm_phase phase);
		super.connect_phase(phase);
		`uvm_info(get_type_name(), "connect_phase() in agent start...", UVM_LOW);
		this.drv.seq_item_port.connect(this.seqr.seq_item_export);
	endfunction: connect_phase
	
endclass: spt_agent
